package heima3_2.cn.osc.hold;

import android.content.Context;
import android.text.Html;
import android.text.Spanned;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;


import net.oschina.app.R;

import butterknife.Bind;
import butterknife.ButterKnife;
import heima3_2.cn.osc.base.BaseHolder;
import heima3_2.cn.osc.base.MyBaseAdapter;
import heima3_2.cn.osc.model.bean.ActiveBean;

/**
 * Created by emily on 2017/1/15.
 */
public class FriendsHolder extends BaseHolder<ActiveBean> {
    @Bind(R.id.im_friends)
    ImageView imFriends;
    @Bind(R.id.tv_time)
    TextView tvTime;
    @Bind(R.id.tv_heima)
    TextView tvHeima;
    @Bind(R.id.tv_state)
    TextView tvState;
    @Bind(R.id.tv_content)
    TextView tvContent;
    @Bind(R.id.tv_android)
    TextView tvAndroid;
    public FriendsHolder(Context context, ViewGroup parent, MyBaseAdapter<ActiveBean> adapter, int position, ActiveBean bean) {
        super(context, parent, adapter, position, bean);
    }
    @Override
    public View onCreateView(Context context, ViewGroup parent, int position, ActiveBean bean) {
        View view = LayoutInflater.from(context).inflate(R.layout.find_fragment_friendsgroup_item, parent, false);
        ButterKnife.bind(this, view);
        return view;
    }
    @Override
    protected void onRefreshView(ActiveBean bean, int position) {
        tvTime.setText(bean.getPubDate());
        String message = bean.getMessage();
        //富文本的显示
        Spanned html = Html.fromHtml(message);
        tvContent.setText(html);
        tvState.setText(bean.getObjecttitle());
        if(bean.getObjecttitle()==null){
            tvState.setText("更新数据");
        }
    }
}
